package game.view;

import game.Board;
import game.Game;

import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;

import javax.swing.JButton;
import javax.swing.JPanel;

/**
 * Operation panel.
 * @author Natchanon Hongladaromp
 *
 */
public class OperationsUI extends JPanel
{
	private Board board;
	
	/**
	 * Construct for this panel
	 * @param game
	 * @param board
	 */
	public OperationsUI(Game game, Board board)
	{
		this.board = board;
		
		initComponents();
	}

	/**
	 * Initial components.
	 */
	private void initComponents()
	{
		this.setLayout(new GridBagLayout());
		GridBagConstraints c = new GridBagConstraints();
		
		String[] opers = new String[]{"+","-","*","/"};
		for(int i=0; i<4; i++)
		{
			JButton b = new JButton(opers[i]);
			b.addActionListener(new OperationListener(board, opers[i]));
			c.fill = GridBagConstraints.HORIZONTAL;
			c.insets = new Insets(10,5,10,5);
			c.ipadx = 30;
			c.ipady = 20;
			c.gridx = i;
			c.gridy = 0;
			add(b,c);
		}
		
		setSize(new Dimension(120, 20));
	}
}
